package com.itheima.day06.myException.test4;

public class Test {
    public static void main(String[] args) {
//        getMessage()       获取异常详细消息字符串
//        toString()              获取异常消息的简短描述
//        printStackTrace()  把异常信息输出在控制台

        try {
            int[] arr = {1,2,3,4,5};
            System.out.println(arr[5]);

        } catch (ArrayIndexOutOfBoundsException e){
            /*String message = e.getMessage();
            System.out.println(message); // Index 5 out of bounds for length 5*/

            /*String s = e.toString();
            System.out.println(s); // java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 5*/

            e.printStackTrace(); //java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 5
            //                        at com.itheima.day06.myException.test4.Test.main(Test.java:11)
        }
        System.out.println("嘿嘿嘿");


    }
}
